home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 April: Mac OS SDK / Dev.CD Apr 96 SDK / Dev.CD Apr 96 SDK1.toast / Development Kits (Disc 1) / OpenDoc Development Framework / ODFDev / ODF / OS / Layer / Sources / FWLibMai.cpp next >
Encoding:
Text File  |  1995-11-08  |  2.0 KB  |  89 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                FWLibMai.cpp
  4. //    Release Version:    $ 1.0d11 $
  5. //
  6. //    Creation Date:        3/25/94
  7. //
  8. //    Copyright:    © 1995 by Apple Computer, Inc., all rights reserved.
  9. //
  10. //========================================================================================
  11.  
  12. #ifdef FW_BUILD_WIN
  13.  
  14. #ifndef FWSTDDEF_H
  15. #include "FWStdDef.h"
  16. #endif
  17.  
  18. #ifndef __WINDOWS_H
  19. #include <Windows.h>
  20. #endif
  21.  
  22. // prevent LibMain from being mangled
  23.  
  24. extern "C"
  25. {
  26. #ifdef FW_BUILD_WIN16
  27.     BOOL CALLBACK LibMain(HANDLE    hInstance,
  28.                           WORD        wDataSeg,
  29.                           WORD        cbHeap,
  30.                           LPSTR        lpszCmdLine);
  31. #endif
  32. #ifdef FW_BUILD_WIN32S
  33.     BOOL WINAPI DllMain(HANDLE    hDLL,
  34.                         DWORD    dwReason,
  35.                         LPVOID    lpReserved);
  36.     void _cinit();            // static constructors
  37.     void _dodtors();        // static destructors
  38. #endif
  39. };
  40.  
  41. #ifdef FW_BUILD_WIN16
  42.  
  43. HINSTANCE FW_SHARED_DATA gFWOSInstance = NULL;
  44.  
  45. //----------------------------------------------------------------------------------------
  46. // GetDLLInstance
  47. //----------------------------------------------------------------------------------------
  48.  
  49. HINSTANCE GetDLLInstance()
  50. {
  51.     return gFWOSInstance;
  52. }
  53.  
  54. //----------------------------------------------------------------------------------------
  55. // LibMain
  56. //----------------------------------------------------------------------------------------
  57. BOOL CALLBACK LibMain(HANDLE         hInstance,
  58.                       WORD        /* wDataSeg        */,
  59.                       WORD        /* cbHeap        */,
  60.                       LPSTR        /* lpszCmdLine    */)
  61. {
  62.     gFWOSInstance = hInstance;
  63.     return hInstance != NULL;
  64. }
  65. #endif
  66.  
  67. #ifdef FW_BUILD_WIN32S
  68.  
  69. #pragma DOSSEG
  70. #pragma startaddress(DllMain)
  71.  
  72. //----------------------------------------------------------------------------------------
  73. // DllMain
  74. //----------------------------------------------------------------------------------------
  75. BOOL WINAPI DllMain(HANDLE    /* hDLL            */,
  76.                     DWORD        dwReason,
  77.                     LPVOID    /* lpReserved    */)
  78. {
  79.     if(dwReason == DLL_PROCESS_ATTACH)
  80.         _cinit();
  81.     else if(dwReason == DLL_PROCESS_DETACH)
  82.         _dodtors();
  83.  
  84.     return TRUE;
  85. }
  86. #endif
  87.  
  88. #endif
  89.